# Reliable Provisional Responses Plugin

* [Name](#name)
* [Description](#description)
* [Dependant Plugins](#dependant-plugins)
* [Configuration Values](#configuration-values)
* [API Functions](#api-functions)
* [Callback Functions](#callback-functions)
* [Examples](#examples)


## Name
### `nksip_100rel`


## Description

This plugin provides reliable provisional responses, according to RFC3262.

Ater an _INVITE_ request, the _UAS_ can send provisional (1xx) responses, that are not usually acknowledged. Activating this plugin, "100rel" is added to the all generated _Supported_ headers, indicating to the remote party that we support reliable provisional responses. If the other party supports them also, it can add a "Require: 100rel" header to any provisional response, and NkSIP will send a _PRACK_ request to acknowledge them.

_PRACK_ will also be added to automatically generated _Allow_ headers.

To send reliable provisonal responses when receiving an INVITE request, you can use the reply codes `rel_ringing` and `rel_session_progress` instead of `ringing` and `session_progress`.



## Dependant Plugins

None


## Configuration Values

### Service configuration values

None

### Request generating options

When sending an INVITE using [invite/2,3](../reference/sending_functions.md#invite), you can add the option `{prack_callback, Fun}`. If included, this function will be called when a reliable provisional response has been received, and before sending the corresponding PRACK. 

It will be called as `Fun(RemoteSDP, {resp, Code, Resp, Call})`. If RemoteSDP is a SDP, it is an offer and you must supply an answer as function return. If it is <<>>, you can return <<>> or send a new offer. If this option is not included, PRACKs will be sent with no body.


### Reply options

When sending a reply to an incoming request, if you want it to be sent as a reliable provisional response, use reply codes `rel_ringing` and `rel_session_progress` instead of `ringing` and `session_progress`.

You can also add the option `do100rel` to any response to use a reliable provisional response.



## API functions

None


## Callback functions

You can implement any of these callback functions in your Service callback module.

### sip_prack/2

```erlang
sip_prack(Req::nksip:request(), Call::nksip:call()) ->
    {reply, nksip:sipreply()} | noreply.
```
Called when a valid PRACK request is received. You should not usually implement this function.


## Examples

See [prack_test.erl](../../test/prack_test.erl) for examples
